

var btn = document.getElementById('btn-save');
btn.onclick = function(){

    var username=$("#username").val();
    if(username.length==0){
        layer.msg("用户名不能为空");
        return false;
    }
    var password=$("#password").val();
    if(password.length==0){
        layer.msg("密码不能为空");
        return false;
    }
    login(username,password);
}
function login(username,pwd){
    debugger
    $.ajax({
        type:"post",
        url:"http://localhost:8089/Login/login",
        dataType:"json",
        data:{
            username:username,password:pwd
        },
        success:function (Result) {
            if(Result.flag){
                location.href="index";
            }else{
                layer.msg(Result.message+",请重新输入");
            }
        }
    })
}